<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>index.html</title>

		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="this is my page">
		<meta http-equiv="content-type" content="text/html; charset=UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" type="text/css"
			href="css/jquery.mobile-1.4.5.min.css">
		<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
		<script type="text/javascript" src="js/jquery.mobile-1.4.5.js"></script>
		<link rel="stylesheet" type="text/css"
			href="css/jquery.mobile-1.4.5.min.css">
		<script type="text/javascript" src="js/jquery.mobile.simpledialog.min.js"></script>
	</head>
	<body>
	    <script type="text/javascript">
	    $(function(){
	         $.ajax({
					url: "../workReportApp!queryWorkItemList",
					data: {
				},
				success: function(data) {
					var obj = eval('(' + data + ')');
					if (obj.result == 1) {
					   var itemHtml = "";
					   for ( var i = 0; i < obj.datas.length; i++) {
							itemHtml = itemHtml+"<li><a id='"+obj.datas[i].id+"' class='itemInfoId'>"+obj.datas[i].content+"<span style='display:none;' id='info"+obj.datas[i].id+"'>"+obj.datas[i].info+"</span><span style='display:none;' id='time"+obj.datas[i].id+"'>"+obj.datas[i].time+"</span><span style='display:none;' id='createTime"+obj.datas[i].id+"'>"+obj.datas[i].createTime+"</span></a><a class='deleteItemId' tip='"+obj.datas[i].id+"'data-rel='dialog' data-icon='delete'>删除</a></li>";
					   }
					   
					   $("#itemsId").html(itemHtml);
					   $('#itemsId').listview('refresh');
					   
						
						//删除操作
						$(".deleteItemId").bind('click',function(){
						       
								$.ajax({
									url: "../workReportApp!deleteWorkItem",
									data: {
									id:$(this).attr("tip")
								},
								success: function(data) {
									var obj = eval('(' + data + ')');
									if (obj.result == 1) {
									   $.mobile.changePage("ribao.html", {transition: "none"});
									   $('#itemsId').listview('refresh');
									   $("#listMsgId").html("");
									}else if(obj.result==2){
									   $("#listMsgId").html(obj.errorMsg);
                                       //alert(obj.errorMsg);
								 	}else if(obj.result==3){
									   $.mobile.changePage("index.html", {transition: "slide"});
									   $("#listMsgId").html("");
									}else{
									   alert("请检查网络是否正常!");
									}
								  }
								});
						});
						
					}else if(obj.result==2){
					   $.mobile.changePage("index.html", {transition: "slide"});
					}
				  }
				});   
	    });
	    </script>
			<div data-role="header" data-position="fixed">
				<a href="index.html" data-role="button" data-icon="arrow-l"
					data-transition="slide">注销</a>
				<h1>
					日报列表
				</h1>
				<a href="add.html" data-role="button" data-icon="plus"
					data-transition="slide">添加</a>
			</div>
			<div data-role="content">
				<ul data-role="listview" data-theme="g" id="itemsId">
				</ul>
			</div>
			<div data-role="footer" data-position="fixed">
				<center>
			    <h3 id='listMsgId'></h3>
					<div>
						<a href="ribaoInfo.html" data-role="button" data-transition="slide">日报详情</a>
					</div>
				</center>
			</div>
	</body>
</html>
